(() => {
	let s = !!localStorage.isDev,
		c =
			(s && console.log("common.js"),
			(_.$base64 = {
				decode(e) {
					return void 0 === e
						? ""
						: this.is(e)
							? $.base64
								? $.base64.decode(e || "", !0)
								: atob(e || "")
							: e;
				},
				encode(e) {
					return void 0 === e
						? ""
						: this.is(e)
							? e
							: $.base64
								? $.base64.encode(e || "", !0)
								: btoa(e || "");
				},
				is(e) {
					e = void 0 === e ? "" : e;
					try {
						return this._encode(this._decode(e)) === e;
					} catch (e) {
						return !1;
					}
				},
				_encode(e) {
					return void 0 === e
						? ""
						: $.base64
							? $.base64.encode(e || "", !0)
							: btoa(e || "");
				},
				_decode(e) {
					return void 0 === e
						? ""
						: $.base64
							? $.base64.decode(e || "", !0)
							: atob(e || "");
				}
			}),
			(_.$reloadWindow = function (e) {
				console.log("🚀 ~ message:", e), window.location.reload();
			}),
			new Proxy(
				{},
				{
					set(e, t, r) {
						if (!e[t]) return (e[t] = r), !0;
						alert(`PRIVATE_GLOBAL ${t} 重复`);
					}
				}
			)),
		t =
			((_.$desensitize = function (e, t = "custom", r = {}) {
				if (!e) return e;
				let n = 0,
					a = 0;
				var o = r.mask || "*";
				switch (t) {
					case "phone":
						(n = 3), (a = 4);
						break;
					case "email":
						var i = e.indexOf("@");
						if (-1 < i)
							return (
								e.substring(0, Math.min(3, i)) +
								o.repeat(Math.max(0, i - 3)) +
								e.substring(i)
							);
						(n = 3), (a = 4);
						break;
					case "idcard":
						(n = 4), (a = 4);
						break;
					case "name":
						(n = 1), (a = 0);
						break;
					case "custom":
						(n = r.start || 0), (a = r.end || 0);
				}
				var t = e.length,
					l = Math.max(0, t - n - a);
				return e.substring(0, n) + o.repeat(l) + e.substring(t - a);
			}),
			(_.$getRawQueryParamFromSearch = function (e) {
				let t = location.search;
				var r;
				for (r of (t = t.startsWith("?") ? t.slice(1) : t).split("&")) {
					var [n, a] = r.split("=");
					if (n === e) return a;
				}
				return null;
			}),
			(_.$arrayToTree = function ({
				data: e,
				id: t,
				pid: r,
				children: n,
				label: a,
				value: o,
				rootId: i
			}) {
				e = _.cloneDeep(e);
				let l = t || "id",
					s = r || "parentId",
					c = n || "children",
					u = a || "label",
					d = o || "value",
					p = _.$isInput(i) ? i : null,
					$ = {},
					m = {},
					f = [];
				return (
					_.each(e, e => {
						(e.label = e[u]), (e.value = e[d]);
						var t = e[s];
						($[t] = $[t] || []), (m[e[l]] = e), $[t].push(e);
					}),
					_.each(e, e => {
						e[s] == p && f.push(e);
					}),
					_.each(f, function e(t) {
						null !== $[t[l]] && (t[c] = $[t[l]]), t[c] && _.each(t[c], e);
					}),
					{ TREE: f, CHILDREN_MAP: $, NODES_OBJ: m }
				);
			}),
			(_.$updateCol = function (e, t, r) {
				var t = _.findIndex(e.columns, { prop: t }),
					n = e.columns[t],
					n = _.merge(n, r);
				e.columns.splice(t, 1, n);
			}),
			(_.$pickFromArray = function (e, r, n = "prop") {
				return (
					(_.$isArrayFill(r) && _.$isArrayFill(e)) ||
						alert("pickFromArray miss props array"),
					_.reduce(e, (e, t) => (r.includes(t[n]) && (e[t[n]] = t), e), {})
				);
			}),
			(_.$percent = function (e, t) {
				return _.isNumber(e) && _.isNumber(t)
					? 0 < t
						? Math.round((e / t) * 100)
						: void 0
					: 0;
			}),
			(_.$coerceTruthyValueToArray = function (e) {
				return Array.isArray(e) ? e : e ? [e] : [];
			}),
			(_.$flatNodes = (e, r) =>
				e.reduce(
					(e, t) => (
						t.isLeaf
							? e.push(t)
							: (r || e.push(t), (e = e.concat(_.$flatNodes(t.children, r)))),
						e
					),
					[]
				)),
			(_.$isDef = e => null != e),
			(_.$traverse = function (t, r, n, a = "") {
				var o = _.$val(n, "children") || "children";
				if (_.isEmpty(t)) _.$traverse([t], r, n);
				else {
					let e = t.length - 1;
					for (; -1 < e; ) {
						var i = t[e];
						if (!1 === r(i, t, a + "." + e)) break;
						~_.findIndex(t, i) &&
							!_.isEmpty(i[o]) &&
							(i[o] = _.$traverse(i[o], r, n, `${a}.${e}.` + o)),
							e--;
					}
				}
				return t;
			}),
			(_.$setDocTitle = e => e && (document.title = e)),
			(_.$md5 = async function (a) {
				return new Promise(async (t, e) => {
					let r = await _.$appendScript("/common/libs/spark-md5.js", "SparkMD5");
					var n = new FileReader();
					(n.onload = e => {
						e = r.ArrayBuffer.hash(e.target.result);
						t(e);
					}),
						(n.onerror = e),
						n.readAsArrayBuffer(a);
				});
			}),
			(_.$bytesToSize = function (e) {
				var t, r;
				return e
					? ((r =
							["KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"][
								(t = Math.floor(Math.log(e) / Math.log(1024))) - 1
							] || "Byte"),
						(e / Math.pow(1024, t)).toPrecision(3) + " " + r)
					: "0 KB";
			}),
			(_.$rafThrottle = function (r) {
				let n = !1;
				return function (...t) {
					n ||
						((n = !0),
						window.requestAnimationFrame(e => {
							r.apply(this, t), (n = !1);
						}));
				};
			}),
			(_.$copyToClipboard = function (e) {
				if (navigator.clipboard && window.isSecureContext)
					return navigator.clipboard.writeText(e);
				{
					let r = document.createElement("textarea");
					return (
						(r.value = e),
						(r.style.position = "absolute"),
						(r.style.opacity = 0),
						(r.style.left = "-999999px"),
						(r.style.top = "-999999px"),
						document.body.appendChild(r),
						r.focus(),
						r.select(),
						new Promise((e, t) => {
							(document.execCommand("copy") ? e : t)(), r.remove();
						})
					);
				}
			}),
			(_.$ramdomStr = function (t) {
				t = t || 26;
				var r = "abcdefhijkmnprstwxyz0123456789",
					n = r.length,
					a = "";
				for (let e = 0; e < t; e++) a += r.charAt(Math.floor(Math.random() * n));
				return a;
			}),
			(_.$openFileSelector = function (e = {}) {
				let { accept: a, multiple: o } = e,
					i = ((a = a || "*"), (o = o || !1), !1);
				return new Promise(r => {
					try {
						let e = document.createElement("input"),
							t =
								((e.style.display = "none"),
								e.setAttribute("type", "file"),
								e.setAttribute("accept", a),
								o && e.setAttribute("multiple", o),
								document.body.appendChild(e),
								$(e));
						t.one("change.openFileSelector", function () {
							(i = !0), r(e.files), t.remove(), (t = null), (e = null);
						});
						var n = _.debounce(() => {
							!i && e && (r([]), t.remove(), (t = null), (e = null));
						}, 1e3);
						_.$single.win.one("focus.openFileSelector", n), e.click();
					} catch (e) {
						r([]), console.error(e);
					}
				});
			}),
			(_.$readFileAsText = async function (n) {
				return new Promise((e, t) => {
					var r = new FileReader();
					r.readAsText(n),
						(r.onload = function () {
							e(r.result);
						}),
						(r.onerror = t);
				});
			}),
			(_.$downloadTextAsBlob = function (n, a) {
				return new Promise(e => {
					var t = document.createElement("a"),
						r =
							((t.download = a),
							(t.style.display = "none"),
							new Blob([n], { type: "text/plain;charset=utf-8" }));
					(t.href = URL.createObjectURL(r)),
						document.body.appendChild(t),
						t.click(),
						document.body.removeChild(t),
						e();
				});
			}),
			(_.$translateStrByNull = e => ("" === e ? null : e)),
			(_.$timeAgo = function (e) {
				let t, r, n, a, o;
				e = parseInt(String(new Date().getTime() / 1e3)) - e;
				return (
					(o = 31104e3 < e ? parseInt(String(e / 31104e3)) : 0),
					(a = 2592e3 < e ? parseInt(String(e / 2592e3)) : 0),
					(n = 86400 < e ? parseInt(String(e / 86400)) : 0),
					(r = 3600 < e ? parseInt(String(e / 3600)) : 0),
					(t = parseInt(String(e / 60))),
					0 < o
						? o + "年前"
						: 0 < a && o <= 0
							? a + "月前"
							: 0 < n && a <= 0
								? n + "天前"
								: n <= 0 && 0 < r
									? r + "小时前"
									: r <= 0 && 0 < t
										? t + "分钟前"
										: !(t <= 0 && 0 < e) || e < 30
											? "刚刚"
											: e + "秒前"
				);
			}),
			(_.$isEqualByObjVal = (r, n) => {
				var e, t;
				return (
					r === n ||
					(!(!r || !n) &&
						typeof r == typeof n &&
						("object" != typeof r
							? r === n
							: Array.isArray(r) === Array.isArray(n) &&
								(Array.isArray(r)
									? r.length === n.length &&
										r.every((e, t) => _.$isEqualByObjVal(e, n[t]))
									: ((e = Object.keys(r)),
										(t = Object.keys(n)),
										e.length === t.length &&
											_.every(e, e => {
												var t = r[e],
													e = n[e];
												return _.isFunction(t) && _.isFunction(e)
													? t.toString() === e.toString()
													: _.$isEqualByObjVal(t, e);
											})))))
				);
			}),
			(window.defTable = e => (
				Vue.hasOwn(e, "isHideFilter") || (e.isHideFilter = !1),
				Vue.hasOwn(e, "isHideQuery") || (e.isHideQuery = !1),
				Vue.hasOwn(e, "pagination") || (e.pagination = { page: 1, total: 0, size: 10 }),
				Vue.hasOwn(e, "disabled") || (e.disabled = !1),
				_.isArray(e.columns) && e.columns.push({}),
				e
			)),
			(window.defTable.colExpandArrow = (e = {}) => {
				let t = Vue.h;
				var r = () => t("div"),
					n = e.width || 24,
					a = e.fixed || "",
					o = e.headerCellRenderer || r,
					e = e.cellRenderer || r;
				return {
					prop: "COL_EXPAND_ARROW",
					label: i18n("COL_EXPAND_ARROW"),
					width: n,
					fixed: a,
					headerCellRenderer: o,
					cellRenderer: e
				};
			}),
			(window.defTable.colMultiple = ({ by: i, getConfigs: l, disabled: s, isHide: c }) => {
				let u = Vue.h;
				return {
					prop: "COL_MULTIPLE",
					label: i18n("checkbox"),
					width: 48,
					fixed: "left",
					headerCellRenderer(e) {
						let t = l();
						var r = 0 < t.data.list.length && t.data.set.size === t.data.list.length,
							r = {
								indeterminate:
									0 < t.data.set.size && t.data.set.size < t.data.list.length,
								value: r,
								onChange() {
									var e = Array.from(t.data.set);
									t.data.set.size < t.data.list.length
										? _.each(t.data.list, e => t.data.set.add(_.$val(e, i)))
										: _.each(t.data.list, e => t.data.set.delete(_.$val(e, i))),
										(t.data.set = new Set(Array.from(t.data.set))),
										_.isFunction(t.onSelectedChange) &&
											t.onSelectedChange(Array.from(t.data.set), e);
								}
							},
							r = u("xCheckbox", r);
						return u("div", { class: "flex center width100" }, [r]);
					},
					cellRenderer: e => {
						if (!!_.isFunction(c) && c(e)) return null;
						let r = e.rowData,
							n = l();
						var t = n.data.set.has(_.$val(r, i));
						let a = "",
							o = !!_.isFunction(s) && s(e);
						return (
							_.isString(o) && (o = !!(a = o)),
							u("div", { class: "flex center width100" }, [
								u("xCheckbox", {
									value: t,
									disabled: o,
									attrs: { title: a },
									onChange(e) {
										var t = Array.from(n.data.set);
										e
											? n.data.set.add(_.$val(r, i))
											: n.data.set.delete(_.$val(r, i)),
											(n.data.set = _.clone(n.data.set)),
											n.onSelectedChange &&
												n.onSelectedChange(Array.from(n.data.set), t);
									}
								})
							])
						);
					}
				};
			}),
			(window.defTable.colSingle = ({ by: i, getConfigs: l, disabled: s }) => {
				let c = Vue.h;
				return {
					prop: "COL_SINGLE",
					label: i18n("checkbox"),
					width: 48,
					fixed: "left",
					headerCellRenderer(e) {
						return null;
					},
					cellRenderer: e => {
						let n = e.rowData,
							a = l();
						var t = a.data.set.has(_.$val(n, i));
						let r = "",
							o = !!_.isFunction(s) && s(e);
						return (
							_.isString(o) && (o = !!(r = o)),
							c("div", { class: "flex center width100" }, [
								c("xCheckbox", {
									value: t,
									disabled: o,
									attrs: { title: r },
									onChange(e) {
										var t = Array.from(a.data.set),
											r = _.$val(n, i);
										(a.data.set = e ? new Set([r]) : new Set()),
											a.onSelectedChange &&
												a.onSelectedChange(Array.from(a.data.set), t);
									}
								})
							])
						);
					}
				};
			}),
			(window.defTable.colActions = ({ cellRenderer: e, width: t, fixed: r = "right" }) => {
				r = {
					prop: "COL_ACTIONS",
					label: i18n("operation"),
					fixed: r,
					width: t,
					headerCellRenderer(e) {
						return i18n("operation");
					}
				};
				return e && (r.cellRenderer = e), r;
			}),
			(window.defItems = e =>
				_.reduce(
					e,
					(e, t, r) => (Vue.hasOwn(t, "disabled") || (t.disabled = !1), (e[r] = t), e),
					{}
				)),
			(window.defItem = (...e) => {
				e = _.merge.apply(_, e);
				return Vue.hasOwn(e, "disabled") || (e.disabled = !1), Vue.reactive(e);
			}),
			(window.defItem.X_ITEM_LABEL_IS_EMPTY = "X_ITEM_LABEL_IS_EMPTY"),
			(_.$isHttp = e => -1 !== e.indexOf("http://") || -1 !== e.indexOf("https://")),
			(_.$isArrayFill = e => _.isArray(e) && 0 < e.length),
			(_.$isExternal = function (e) {
				return /^(https?:|mailto:|tel:)/.test(e);
			}),
			(_.$isSame = (e, t) => String(e) === String(t)),
			(_.$isIE = function () {
				return !Vue.prototype.$isServer && !isNaN(Number(document.documentMode));
			}),
			(_.$isEdge = function () {
				return !Vue.prototype.$isServer && -1 < navigator.userAgent.indexOf("Edge");
			}),
			(_.$isFirefox = function () {
				return !Vue.prototype.$isServer && !!window.navigator.userAgent.match(/firefox/i);
			}),
			(_.$getLeftTopFromAbsolute = e => {
				var t = e.css("top"),
					e = e.css("left"),
					r = e => {
						e = String(e).match(/^(.*)px$/);
						return e && e[1] ? Number(e[1]) : 0;
					};
				return { top: r(t), left: r(e) };
			}),
			(_.$getLeftTopFromTranslate = e => {
				var t,
					r,
					n,
					a,
					o,
					e = e.css("transform"),
					e = String(e).match(/^matrix\((.*)\)$/);
				return e
					? e && e[1]
						? (([e, t, r, n, a, o] = String(e[1])
								.split(",")
								.map(e => Number(_.trim(e)))),
							{ left: e + r + a, top: t + n + o })
						: void 0
					: { top: 0, left: 0 };
			}),
			(_.$aHashLink = (e, t = {}) => {
				(e = ((e, t) => {
					(e = new URL(String(e).replace("#", ""), location.origin)).search =
						new URLSearchParams(t).toString();
					var { pathname: t, search: r } = e;
					return { href: "" + t + r, url: e };
				})(e, t).url),
					(t = new URL(location.href, location.origin));
				return (t.hash = e.href.replace(e.origin, "")), t.href;
			}),
			(Vue.prototype.$aHashLink = _.$aHashLink),
			(_.$setAppTheme = function (e) {
				$("html").attr("data-theme", e || ""), $(window).trigger("x_ui_theme_change", e);
			}),
			(_.$valueEquals = (t, r) => {
				if (t !== r) {
					if (!(t instanceof Array)) return !1;
					if (!(r instanceof Array)) return !1;
					if (t.length !== r.length) return !1;
					for (let e = 0; e !== t.length; ++e) if (t[e] !== r[e]) return !1;
				}
				return !0;
			}),
			(_.$scrollIntoView = function (t, r) {
				if (r) {
					var n = [];
					let e = r.offsetParent;
					for (; e && t !== e && t.contains(e); ) n.push(e), (e = e.offsetParent);
					r = r.offsetTop + n.reduce((e, t) => e + t.offsetTop, 0);
					t.scrollTo({ top: r, behavior: "smooth" });
				} else t.scrollTop = 0;
			}),
			(_.$firstUpperCase = function (e) {
				return e.toLowerCase().replace(/( |^)[a-z]/g, e => e.toUpperCase());
			}),
			(_.$isMac = function () {
				return /macintosh|mac os x/i.test(navigator.userAgent);
			}),
			(_.$isNumber = e => _.isNumber(e) && !_.isNaN(e)),
			(_.$isKorean = function (e) {
				return /([(\uAC00-\uD7AF)|(\u3130-\u318F)])+/gi.test(e);
			}),
			(_.$filterSomeInput = e => _.filter(e, e => _.some(e, e => _.$isInput(e)))),
			(_.$filterAllInput = e => _.filter(e, e => _.every(e, e => _.$isInput(e)))),
			(_.$trylog = t => {
				try {
					return t();
				} catch (e) {
					console.error(t.toString()), console.error(e);
				}
			}),
			(_.$lStorage = new Proxy(localStorage, {
				set(e, t, r) {
					return (
						console.log("🚀 ~ set ~ _localStorage:", t, r),
						_.isPlainObject(r) || _.isArray(r)
							? (e[t] = JSON.stringify(r))
							: (e[t] = r),
						!0
					);
				},
				get(t, e) {
					let r = t[e];
					t = () => (_.$isInput(r), r);
					try {
						return /^[{|\[]/.test(r) ? JSON.parse(r) : t();
					} catch (e) {
						return t();
					}
				}
			})),
			(_.$genId = function (e) {
				return (
					_.$genId.idCount > _.$genId.ID_COUNT_MAX &&
						((_.$genId.idCount = 1), (_.$genId.DATE_NOW = Date.now())),
					`${e}_${_.$genId.DATE_NOW}_` + _.$genId.idCount++
				);
			}),
			(_.$genId.idCount = 1),
			(_.$genId.ID_COUNT_MAX = 4e4),
			(_.$genId.DATE_NOW = Date.now()),
			(_.$dateFormat = (e = null, t = 0) => {
				let r = "YYYY-MM-DD HH:mm:ss";
				"number" == typeof (e = e || Date.now()) &&
					(10 === String(e).length && (e = dayjs.unix(e)), 13 === String(e).length) &&
					(e = dayjs(e)),
					1 === t && (r = "YYYY-MM-DD"),
					2 === t && (r = "YYYYMMDDHHmmss"),
					t || (r = "YYYY-MM-DD HH:mm:ss");
				t = dayjs(e).format(r);
				return "Invalid Date" == t ? "--" : t;
			}),
			(_.$val2L = (t, e, r = "") => {
				e = _.find(e, e => String(e.value) === String(t));
				return e ? e.label : r;
			}),
			(_.$randomName = (e, t = 16) =>
				e + parseInt((new Date().getTime() % 61439) + 4096).toString(t)),
			(_.$is200 = function (e) {
				return "200" === String(e);
			}),
			(_.$isEveryInput = function (t, e = []) {
				return (
					0 < Object.keys(t).length &&
					(_.$isArrayFill(e)
						? _.every(e, e => _.$isInput(t[e]))
						: _.every(Object.entries(t), ([, e]) => _.$isInput(e)))
				);
			}),
			(_.$execfnify = function (e, t) {
				if (_.isFunction(e)) return e.call(null, t);
			}),
			(_.$isInput = function (e) {
				return _.isArray(e) ? 0 < e.length : !!e || 0 === e || !1 === e;
			}),
			(_.$doNoting = () => null),
			(_.$sleep = t => new Promise(e => setTimeout(e, t))),
			(_.$asyncDebounce = (t, n, a = 1e3) => {
				let o, i, l, s;
				return async function (...e) {
					let r = () =>
						setTimeout(() => {
							n.apply(t, e).then(l, s);
						}, a);
					return (
						o && (clearTimeout(o), (o = r())),
						(i =
							i ||
							new Promise((e, t) => {
								(l = e), (s = t), (o = r());
							}))
					);
				};
			}),
			window.console);
	var e = e => (s || localStorage.mustShowLog ? t[e].bind(t) : () => null);
	async function o(n, a) {
		return (
			(a = _.$resolvePath(a)),
			new Promise(async e => {
				var t, r;
				return _.$val(window, n) && o[n] === _.$val(window, n)
					? e(_.$val(window, n))
					: "IS_PENDDING" === o[n]
						? (await _.$ensure(() => o[n] === _.$val(window, n)), e(_.$val(window, n)))
						: ((t = _.camelCase(a)),
							(o[n] = "IS_PENDDING"),
							void (
								(r = _.$$id(t)) ||
								(((r = document.createElement("script")).id = t),
								_.$$tags("body")[0].appendChild(r),
								(r.onload = () => {
									(o[n] = _.$val(window, n)), e(_.$val(window, n));
								}),
								(r.src = a))
							));
			})
		);
	}
	(console.table = e("table")),
		(console.log = e("log")),
		(console.warn = e("warn")),
		(console.info = e("info")),
		(console.time = e("time")),
		(console.timeEnd = e("timeEnd")),
		(_.$loading = function (e = !1, t = "body") {
			var r, n;
			(_.$loading.count = _.$loading.count || 0),
				e
					? (_.$loading.count || $(t).addClass("x-loading"), _.$loading.count++)
					: ((r = t),
						_.$loading.count--,
						_.$loading.count < 1 &&
							((n = setTimeout(() => {
								_.$loading.count < 1
									? $(r).removeClass("x-loading")
									: clearTimeout(n);
							}, 400)),
							(_.$loading.count = 0)));
		}),
		(_.$confirm = (i = {}) =>
			new Promise(async (e, t) => {
				var r = !!(i = _.isString(i) ? { content: i } : i).isDelete;
				let n = i.title || i18n("message");
				var a = i.content || "";
				if (r) {
					let t = n || i18n("删除");
					n = function () {
						var e = Vue.h;
						return e("div", { staticClass: "flex middle start warning-color" }, [
							e("i", {
								icon: "delete",
								staticClass: "el-alert__icon el-icon-warning",
								staticStyle: "color:var(--xAlert-error-light-color)"
							}),
							e("span", { staticClass: "ml4" }, [t])
						]);
					};
				}
				let o = await _.$openModal({
					title: n,
					url: c.x_confirm_window_component,
					style: i.style,
					resolve: e,
					reject: t,
					content: a,
					isDelete: r
				});
				return (
					_.isFunction(i.setModalVm) && i.setModalVm({ modalVm: o }),
					o.$on("hook:beforeDestroy", () => {
						o.isClickCloseIcon && t();
					}),
					o
				);
			})),
		(_.$confirm_important = (e = {}) => (
			((e = _.isString(e) ? { content: e } : e).title = e.title || i18n("tips")),
			(e.isDelete = !0),
			_.$confirm(e)
		)),
		(_.$msgSuccess = e => _.$notify.success({ title: i18n("tips"), message: e })),
		(_.$msgError = t => {
			if (t) {
				if ((console.log("🚀 ERROR: ", t), _.isPlainObject(t))) {
					if (200 === t.status) return;
					_.isString(t.error)
						? (t = t.error)
						: _.isString(_.$val(t, "responseJSON.detailArgs"))
							? (t = t.responseJSON.detailArgs)
							: _.isString(t.responseText)
								? (t = t.responseText)
								: _.isString(t.message)
									? (t = t.message)
									: _.isString(t.msg) && (t = t.msg);
				} else
					try {
						let e = JSON.parse(e);
						_.$val(e, "responseJSON.detailArgs")
							? (t = _.$val(e, "responseJSON.detailArgs"))
							: _.$val(e, "responseText")
								? (t = e.responseText)
								: _.$val(e, "message") && (t = e.message);
					} catch (e) {}
				return _.$notify.error({ title: i18n("错误"), message: t });
			}
		}),
		(_.$openWindow_deprecated = async (e, t, r = {}) =>
			_.$openModal({ title: e, _VueCtor: t, ...r })),
		(_.$globalVar = o),
		(_.$urlSearch = (e, t) => {
			t = t || location.search;
			let r = new URLSearchParams(t);
			return _.map(e, e => r.get(e));
		}),
		(_.$location = {
			hash(e, t) {
				var r = location.hash.replace(/^#/, ""),
					r = new URLSearchParams(r);
				if (!t) return r.get(e);
				r.has(e) ? r.set(e, t) : r.append(e, t);
				e = r.toString();
				location.hash = decodeURIComponent(e);
			}
		});
	{
		let n = {};
		(_.$GenComponentOptions = async function ({
			resolvedURL: t,
			scritpSourceCode: r,
			templateSourceCode: n,
			payload: a
		}) {
			try {
				(a = a || {}),
					(r = (r = window.Babel ? window.Babel.babelTransformCode(r) : r).replace(
						"export default",
						""
					));
				var o = [
					`console.info("${t}");`,
					n && s ? `(()=>\`${n}\`)();` : "",
					`try{const ${_.camelCase(t)} = ${r};return ${_.camelCase(t)}.call({THIS_FILE_URL:"${t}"},payload);}catch(e){console.error(e)}`
				].join("\n");
				let e;
				var i = {};
				try {
					e = new Function(
						"payload",
						"PRIVATE_GLOBAL",
						`with ({...PRIVATE_GLOBAL,..._,...Vue,}){${o};}`
					);
				} catch (e) {
					throw (console.error(o), e);
				}
				var l = new Proxy(a, {
						get(e, t) {
							return "PRIVATE_GLOBAL" === t ? c : (void 0 !== e[t] ? e : Vue)[t];
						}
					}),
					i = await e(l, c);
				return n && (i.template = n), i;
			} catch (e) {
				console.error(r), console.error(e);
			}
		}),
			(_.$GenComponentOptions.optionsSets = new Set()),
			(_.$single = new Proxy(
				{},
				{
					get(e, t) {
						var r;
						return (
							e[t] ||
								("doc" === t && (e[t] = $(window.document)),
								"body" === t && (e[t] = $(window.document.body)),
								"win" === t && (e[t] = $(window)),
								"shadowTemplate" === t &&
									(e[t] = $("<div/>", {
										style: "opacity: 0;position: fixed;z-index: -1;",
										class: "shadow-template-wrapper"
									}).appendTo(_.$single.body)),
								"mask" === t &&
									((r = $("#x-layer-move")).length
										? (e[t] = r)
										: (e[t] = $(
												'<div id="x-layer-move" class="x-layer-move" />'
											).appendTo(_.$single.body)))),
							e[t]
						);
					}
				}
			)),
			(_.$preprocessCssByless = async function (n) {
				let e = (await _.$appendScript("/common/libs/min/less.js", "less")).render;
				return await new Promise(r => {
					e(_.$resolveCssAssetsPath(n), {}, (e, t) => {
						e ? (console.error(n), console.error(e), r({ css: "" })) : r(t.css);
					});
				});
			}),
			(_.$sourceCodeSFC = async function ({ resolvedURL: e, sourceCode: t }) {
				var r = () => {
					(async (e, t) => {
						e && ((e = await _.$preprocessCssByless(e)), _.$appendStyle(t, e));
					})(n[e].styleSourceCode, e);
				};
				return (
					!s && n[e]
						? r()
						: ((t = t || (await _.$loadText(e))),
							(n[e] = (e => {
								function t(e, t) {
									try {
										var r = new RegExp(`<${t}[^(>|())]*>`),
											n = e.match(r),
											a = "";
										return n
											? ((n = n[0]),
												(a = e.slice(
													e.indexOf(n) + n.length,
													e.lastIndexOf("</" + t + ">")
												)),
												[
													(a = ["template", "setup-render"].includes(t)
														? a.replace(/`/g, "\\`")
														: a)
												])
											: [a, {}];
									} catch (e) {
										console.error(e);
									}
								}
								var [r] = t(e, "script"),
									[n] = t(e, "template"),
									[a] = t(e, "style"),
									[e, {}] = t(e, "setup-render");
								return {
									scritpSourceCode: r,
									templateSourceCode: n,
									styleSourceCode: a,
									setupRenderSourceCode: e
								};
							})(t)),
							r()),
					n[e]
				);
			}),
			(_.$vNode = function (e, t, ...r) {
				try {
					var n = Vue.compile(e).render;
					return n.apply(t, r);
				} catch (e) {
					return console.error(e), null;
				}
			}),
			(_.$importVue = async function (e, t = {}) {
				var r;
				return _.isPlainObject(e)
					? e
					: _.isArray(e)
						? Promise.all(_.map(e, e => _.$importVue(e)))
						: ((r = _.$resolvePath(e)),
							_.$importVue.urlSets.add(e),
							_.$sfcVueObject({ resolvedURL: r, payload: t }));
			}),
			(_.$importVue.urlSets = new Set()),
			(_.$sfcVueObject = async function ({ resolvedURL: t, payload: e, sourceCode: r }) {
				(e = e || {}), _.$callFn(_, "$importVue.Nprogress.start")();
				try {
					var { scritpSourceCode: n, templateSourceCode: a } = await _.$sourceCodeSFC({
							resolvedURL: t,
							sourceCode: r
						}),
						o = {
							resolvedURL: t,
							scritpSourceCode: n,
							templateSourceCode: a,
							payload: { ...Vue, ...e }
						},
						i = (await _.$GenComponentOptions(o)) || {};
					return (
						_.$val(e, "parent") && (i.parent = _.$val(e, "parent")),
						(i.FILE_URL = t),
						_.isFunction(i.onLoadSFC) && i.onLoadSFC(),
						i
					);
				} catch (e) {
					return 404 == e
						? {
								FILE_URL: t,
								render(r) {
									return r(
										"div",
										{ class: "x-padding x-card" },
										["Source Code File Not Found", t, 404].map((e, t) =>
											r("h" + (t + 1), e)
										)
									);
								}
							}
						: { FILE_URL: t };
				} finally {
					_.$callFn(_, "$importVue.Nprogress.done")();
				}
			}),
			(_.$newRoute = function (e, t, r = {}) {
				return { name: e, path: e, component: () => _.$importVue(t), ...r };
			});
	}
	function u(e) {
		e = _.isString(e) || e.outerHTML ? $(e) : e.$el ? $(e.$el) : void 0;
		if (e && 0 != e.length) return e;
		throw new Error("selector不是可用的dom元素");
	}
	function i(e) {
		let t = u(e);
		return t ? (0 === (e = t.find("[data-form-item-id^=x_form_id_]")).length ? t : e) : [];
	}
	(_.$setPagination = function (e, t) {
		return t && (e.pagination = _.merge({}, e.pagination, t)), e.pagination;
	}),
		(_.$setTableData = function (
			e,
			{ list: t, total: r = 0, selected: n = [], set: a = new Set() }
		) {
			if (!e.data) throw new Error("table cofigs 必须要有data属性且为对象");
			Vue.set(e.data, "selected", n),
				Vue.set(e.data, "set", a),
				_.isArray(t) && Vue.set(e.data, "list", t),
				e.pagination && (e.pagination.total = r);
		}),
		(_.$xItemVmById = function (e) {
			(e = document.getElementById(e)), (e = (_.$val(e, "dataset") || {}).formItemId);
			return e ? Vue._X_ITEM_VM_S[e] : null;
		}),
		(_.$validateForm = async e => {
			var t,
				r = [];
			for (t of i(e)) {
				var n = t.dataset.formItemId;
				if (n) {
					n = Vue._X_ITEM_VM_S[n];
					let e;
					_.$val(n, "validate")
						? (e = await n.validate())
						: console.log("miss vm in _X_ITEM_VM_S"),
						e && r.push([e, n]);
				}
			}
			return 0 < r.length ? r : [];
		}),
		(_.$hideRow = async (e, r) => {
			_.$setTableData(e.configs, {
				list: _.filter(e.configs.data.list, (e, t) => r({ row: e, index: t }))
			});
		}),
		(_.$modifyItemsAttrs = async (e, t) => {
			var n;
			for (n of i(e)) {
				var a = (n.dataset || {}).formItemId;
				let r = _.$val(Vue, "_X_ITEM_VM_S." + (a || "________No"));
				_.each(t, (e, t) => {
					r && "disabled" === t && Vue.hasOwn(r.privateState, "isDisabled")
						? (r.privateState.isDisabled = e ? "disabled" : "")
						: _.$val(r, "configs") && Vue.set(r.configs, t, e);
				});
			}
		}),
		(_.$getVmById = e => {
			let t = {};
			try {
				var r = (document.querySelector("#" + e).dataset || {}).formItemId;
				t = _.$val(Vue, "_X_ITEM_VM_S." + (r || "________No")) || {};
			} catch (e) {
			} finally {
				return t;
			}
		}),
		(_.$getCellItemVm = (e, t, r) => {
			let n = {};
			try {
				var a,
					o,
					i,
					l = u(r);
				l &&
					((a = `.el-table__body-wrapper [data-row-index=${e}][data-col-prop=${t}]`),
					(o = l.find(a)),
					(i = (_.$val(o, "0.dataset") || {}).formItemId),
					(n = _.$val(Vue, "_X_ITEM_VM_S." + (i || "________No")) || {}));
			} catch (e) {
			} finally {
				return n;
			}
		}),
		(_.$CellItem = function ({ selector: e, rowIndex: t, colProp: r }) {
			return new Proxy(_.$getCellItemVm(t, r, e), {
				get(e, t) {
					return "_$item" === t
						? t => (
								void 0 === t && (t = e.p_value),
								_.$callFn(e, "configs.options.find")(e => e.value === t) || {}
							)
						: e[t];
				}
			});
		}),
		(_.$fillBackData = async function ({ form: e, data: t, order: r }) {
			for (var n, a; (n = r.shift()); )
				_.isString(n) && ((e[n].value = t[n]), await _.$sleep(32)),
					_.isPlainObject(n) &&
						(({ prop: n, until: a } = n), await a(), (e[n].value = t[n]));
		}),
		(_.$resetFormValues = function (e) {
			(e = (e => {
				var t,
					r = [];
				for (t of i(e)) {
					var n = t.dataset.formItemId;
					n && (n = Vue._X_ITEM_VM_S[n]) && r.push(n.configs);
				}
				return r;
			})(e)),
				_.each(e, e => {
					_.isFunction(e.resetValue)
						? e.resetValue()
						: Vue.hasOwn(e, "value") &&
							Vue.hasOwn(e, "resetValue") &&
							(e.value = _.cloneDeep(e.resetValue));
				});
		}),
		(_.$setFormValues = function (r, e) {
			_.each(e, (e, t) => {
				void 0 !== e && _.isPlainObject(r[t]) && (r[t].value = e);
			});
		}),
		(_.$setFormValuesDelay = function (e, t, r = 100) {
			setTimeout(() => {
				_.$setFormValues(e, t);
			}, r);
		}),
		(_.$pickFormValues = function (e) {
			return _.reduce(
				e,
				(e, t, r) => (
					void 0 !== t.value && (e[r] = t.value),
					void 0 !== t.selectValue && (e[r + "_selectValue"] = t.selectValue),
					e
				),
				{}
			);
		}),
		(_.$newI18nMany = async function (e = ["zh-CN", "en-US"]) {
			let r = await Promise.all(_.map(e, e => _.$newI18n({ lang: e })));
			return (...t) => _.map(r, e => e.apply(_, t));
		}),
		(_.$getSelectedItemFrom = function (e) {
			var { options: e, value: t } = e;
			if (_.$isArrayFill(e) && _.$isInput(t)) {
				e = _.find(e, { value: t });
				if (e) return e;
			}
			return { value: "", label: "", labelKey: "" };
		}),
		(_.$valOrDefault = function (e, t) {
			return void 0 === e ? t : e;
		}),
		(_.$valuInArrayOrFirst = function (e, t) {
			let [{ value: r, key: n }] = _.map(t, (e, t) => ({ value: e, key: t }));
			return _.some(e, e => e[n] === r) ? r : _.first(e).value;
		}),
		(_.$getFirstOrDefaultValue = function (e, t) {
			return (
				void 0 === t && alert("_.$getFirstOrDefaultValue miss defaultValue"),
				_.$isArrayFill(e) ? e[0].value : t
			);
		}),
		(_.$getIpInRangeAndUseable = function (e, t, a = []) {
			let o = _.$calculateCidrRange(t);
			return _.$isIp4InCidr(e)(t)
				? { newValue: e, range: o }
				: {
						newValue: (() => {
							var [t, e] = o,
								t = _.$ip4ToInt(t),
								r = _.$ip4ToInt(e);
							for (let e = t + 1; e <= r; e++) {
								var n = _.$intToIp4(e);
								if (!a.includes(n)) return n;
							}
							return "";
						})(),
						range: o
					};
		}),
		(_.$intToIp4 = e =>
			[(e >>> 24) & 255, (e >>> 16) & 255, (e >>> 8) & 255, 255 & e].join(".")),
		(_.$ip4ToInt = e => e.split(".").reduce((e, t) => (e << 8) + parseInt(t, 10), 0) >>> 0),
		(_.$isIp4InCidr = n => e => {
			var [t, r = 32] = e.split("/"),
				r = ~(2 ** (32 - r) - 1);
			return (
				(_.$ip4ToInt(n) & r) == (_.$ip4ToInt(t) & r) &&
				(([t, r] = _.$calculateCidrRange(e)), n !== t) &&
				n !== r
			);
		}),
		(_.$intToBin = e =>
			(e >>> 0)
				.toString(2)
				.padStart(32, 0)
				.match(/.{1,8}/g)
				.join(".")),
		(_.$calculateCidrRange = e => {
			var [e, t = 32] = e.split("/"),
				t = ~(2 ** (32 - t) - 1);
			return [_.$intToIp4(_.$ip4ToInt(e) & t), _.$intToIp4(_.$ip4ToInt(e) | ~t)];
		});
})();
